import cv2
import numpy as np

img1 = cv2.imread("./img/O.png")
img2 = cv2.imread("./img/X.png")

h,w,d = img1.shape

def getMinChannel(channel,img1_channel,img2_channel):
    for i in range(h):
        for j in range(w):
            channel[i][j] = img1_channel[i][j] & img2_channel[i][j]
    return channel

dic_img = img1.copy()
dic_img[:,:,0] = getMinChannel(dic_img[:,:,0],img1[:,:,0],img2[:,:,0])
dic_img[:,:,1] = getMinChannel(dic_img[:,:,1],img1[:,:,1],img2[:,:,1])
dic_img[:,:,2] = getMinChannel(dic_img[:,:,2],img1[:,:,2],img2[:,:,2])

cv2.imshow("dic",dic_img)
cv2.waitKey(0)